package tr.helper.domain;

import java.util.ArrayList;
import java.util.List;
import javafx.scene.control.ChoiceBox;
import javafx.util.Pair;
import javafx.util.StringConverter;
import lombok.Data;

/**
 * tr-service
 *
 * @author MrYe
 * @date 2022-01-13 20:07
 */
@Data
public class DataConfig {

    public static final String DB = "server.db";

    public final static Pair<String, Long> EMPTY_PAIR = new Pair<>("", 0L);

    public static List<Pair<String, Long>> getMasters() {
        List<Pair<String, Long>> selectors = new ArrayList<>();
        selectors.add(new Pair("全部", 0L));
        selectors.add(new Pair("叶", 1L));
        selectors.add(new Pair("李", 2L));
        selectors.add(new Pair("周", 3L));
        selectors.add(new Pair("周张韩", 4L));
        selectors.add(new Pair("叶李周", 5L));
        selectors.add(new Pair("叶李", 6L));
        selectors.add(new Pair("H", 7L));
        return selectors;
    }

    public static void initMasters(ChoiceBox<Pair<String, Long>> controls) {
        controls.setConverter(new StringConverter<Pair<String, Long>>() {
            @Override
            public String toString(Pair<String, Long> pair) {
                return pair.getKey();
            }

            @Override
            public Pair<String, Long> fromString(String string) {
                return null;
            }
        });
        controls.getItems().addAll(DataConfig.getMasters());
    }

}
